package android.bignerdranch.a2_1;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class UC4Activity extends AppCompatActivity {

    public Button uc4_btn1;
    public Button uc4_btn2;
    public Button uc4_btn3;
    public Button uc4_btn4;
    public Button uc4_btn5;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.uc4);

        uc4_btn1 = (Button)findViewById(R.id.uc4_btn1);
        uc4_btn2 = (Button)findViewById(R.id.uc4_btn2);
        uc4_btn3 = (Button)findViewById(R.id.uc4_btn3);
        uc4_btn4 = (Button)findViewById(R.id.uc4_btn4);
        uc4_btn5 = (Button)findViewById(R.id.uc4_btn5);

        uc4_btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                uc4_btn1.setText("第一个按钮被点击");
            }
        });

        uc4_btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                uc4_btn2.setText("第二个按钮被点击");
            }
        });

        uc4_btn3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                uc4_btn3.setText("第三个按钮被点击");
            }
        });

        uc4_btn4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                uc4_btn4.setText("第四个按钮被点击");
            }
        });

        uc4_btn5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(UC4Activity.this,MainActivity.class);
                startActivity(intent);
            }
        });
    }
}
